package main

import (
	"fmt"
	"os"
	"runtime/pprof"
)

func assign(arr []int) {
	length:=len(arr)
	for i:=0;i<length;i++ {
		arr[i]=i
	}
}

func main() {
	fcpu,_:=os.Create("cpu.prof")
	fmem,_:=os.Create("mem.prof")
	pprof.StartCPUProfile(fcpu)

	arr:=make([]int, 1000000)
	assign(arr)
	fmt.Println(arr)

	pprof.WriteHeapProfile(fmem)
	pprof.StopCPUProfile()
	fcpu.Close()
	fmem.Close()

}
